﻿#include "dwgrect.h"

Dwgrect::Dwgrect(QObject *parent)
    : DwgObject{parent}
{}
void Dwgrect::SetData(QPoint pt1, QPoint pt2)
{
    x=pt1.x();
    y=pt1.y();
    w=(pt2.x()-pt1.x())?(pt2.x()-pt1.x()):(pt1.x()-pt2.x());
    h=(pt2.y()-pt1.y())?(pt2.y()-pt1.y()):(pt1.y()-pt2.y());
}

void Dwgrect::Draw(QPainter *painter)
{
    painter->drawRect(x,y,w,h);
}
